package demo.day08.work_Bank;

/**
 * @Auther: hjy(lc))
 * @Date: 2022/7/26-07-26-19:14
 * @Description：demo.day08.work_Bank
 */
public class TestBanking {
    public static void main(String[] args) {
        Bank bank = new Bank() ;
        bank.addCustomer(new Customer("steven")) ;
        bank.addCustomer(new Customer("kevin")) ;
        Customer cust1 = bank.getCustomer(0) ;
        Customer cust2 = bank.getCustomer(1) ;
        cust1.setAccount(new SavingAccount(10000.0, 2.1)) ;       //steven余额10000
        cust2.setAccount(new CheckingAccount(10000.0, 5000.0)) ;    //kevin余额10000，透支额度为5000
        Account acc1 = cust1.getAccount() ;
        System.out.println(cust1.getName() + "'s account balance is " + acc1.getBalance()) ;
        acc1.deposit(1000.0) ;       //steven存款1000
        System.out.println(cust1.getName() + "'s account balance is " + acc1.getBalance()) ;
        acc1.withdraw(20000.0) ;    //steven取款20000
        System.out.println(cust1.getName() + "'s account balance is " + acc1.getBalance()) ;
        acc1.withdraw(10000.0) ;        //steven取款10000
        System.out.println(cust1.getName() + "'s account balance is " + acc1.getBalance()) ;
        CheckingAccount acc2 = (CheckingAccount) cust2.getAccount() ;
        System.out.println(cust2.getName() + "'s account balance is " + acc2.getBalance() + " and overdraft is "
                + acc2.getOverdraft()) ;
        acc2.deposit(1000.0) ;    //kevin存款1000元
        System.out.println(cust2.getName() + "'s account balance is " + acc2.getBalance() + " and overdraft is "
                + acc2.getOverdraft()) ;
        acc2.withdraw(20000.0) ;      //kevin取款20000元
        System.out.println(cust2.getName() + "'s account balance is " + acc2.getBalance() + " and overdraft is "
                + acc2.getOverdraft()) ;
        acc2.withdraw(3000.0) ;     //kevin取款3000元
        System.out.println(cust2.getName() + "'s account balance is " + acc2.getBalance() + " and overdraft is "
                + acc2.getOverdraft()) ;
        acc2.withdraw(10000.0) ;     //kevin取款10000元
        System.out.println(cust2.getName() + "'s account balance is " + acc2.getBalance() + " and overdraft is "
                + acc2.getOverdraft()) ;
    }
}